﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraGrid.Demos.util;
using Luna小店.DTO;

namespace Luna小店.UC.辅料
{
    public partial class UC辅料 : UserControl
    {
        public String STYLE_CATEGORY_CD { get; set; }//款式类别
        public List<ContrastForUCDto> contrastForUCDtos = new List<ContrastForUCDto>();
        public UC辅料(List<ContrastForUCDto> contrastForUCDtos,String STYLE_CATEGORY_CD)
        {
            this.STYLE_CATEGORY_CD = STYLE_CATEGORY_CD;
            this.contrastForUCDtos = contrastForUCDtos;
            InitializeComponent();
            this.gridControl1.DataSource = this.contrastForUCDtos;
        }

        private void gridView辅料类别_DoubleClick(object sender, EventArgs e)
        {
            foreach (ContrastForUCDto dto in this.contrastForUCDtos)
            {
                if (dto.id.Equals(FunctionHelper.GetgridViewValue(this.gridView辅料类别, this.gridView辅料类别.FocusedRowHandle, "id")))
                {
                    new Frm辅料选择(FunctionHelper.GetgridViewValue(this.gridView辅料类别, this.gridView辅料类别.FocusedRowHandle, "id"), FunctionHelper.GetgridViewValue(this.gridView辅料类别, this.gridView辅料类别.FocusedRowHandle, "code"), FunctionHelper.GetgridViewValue(this.gridView辅料类别, this.gridView辅料类别.FocusedRowHandle, "name"), dto.DtoForChooseContrasts, this.STYLE_CATEGORY_CD).ShowDialog();
                    this.gridControl1.DataSource = this.contrastForUCDtos;
                    this.gridView辅料类别.RefreshData();
                    
                    break;
                }
            }
        }
    }
}
